<?php if (!empty($current_user)) : ?>
<div id="top-menu" style="width: 98%; float: left; margin: 0 1%;">
	<?php if ($current_user['User']['role'] != 'spectator') : ?>
		<a class="left <?php echo ($this->params['controller'].'/'.$this->params['action'] == 'pages/home') ? 'selected' : ''; ?>" href="/">Home</a>
	<?php endif; ?>
	<a class="left <?php echo ($this->params['controller'] == 'tasks') ? 'selected' : ''; ?>" href="/tasks/index">Tasks</a>
	<a class="left <?php echo ($this->params['controller'] == 'documents') ? 'selected' : ''; ?>" href="/documents/index">Documents</a>
	<a class="left <?php echo ($this->params['url']['url'] == 'reports') ? 'selected' : ''; ?>" href="/reports">Reports</a>
	
	<a class="right" href="/users/logout">Logout</a>
	<a class="right  <?php echo (preg_match('/(users\/profile)/', $this->params['url']['url'])) ? 'selected' : ''; ?>" href="/users/profile"><?php echo $current_user['User']['username']; ?></a>
	<?php if($current_user['User']['role'] == 'admin') : ?>
		<span class="separator">|</span>
		<a class="right <?php echo (preg_match('/(projects\/control_projects)|(projects\/(add)|(edit))/', $this->params['url']['url'])) ? 'selected' : ''; ?>" href="/projects/control_projects">Control projects</a>
		<a class="right <?php echo (preg_match('/(users\/control_users)|(users\/add)/', $this->params['url']['url'])) ? 'selected' : ''; ?>" href="/users/control_users">Control users</a>
	<?php endif; ?>
	
</div>
<?php endif; ?>